package com.wandian.view.mediator
{
	import com.wandian.controller.AccountCommand;
	import com.wandian.controller.BankCommand;
	import com.wandian.controller.CLZNoticeName;
	import com.wandian.controller.FriendAndRoomPlayerCommand;
	import com.wandian.controller.GameMessageCommand;
	import com.wandian.controller.GameRoomCommand;
	import com.wandian.controller.HelpCommand;
	import com.wandian.controller.LobbyCommand;
	import com.wandian.controller.PrizeCommand;
	import com.wandian.controller.SelectPersonCommand;
	import com.wandian.controller.ShopCommand;
	import com.wandian.controller.TopCommand;
	import com.wandian.controller.VIPPrivilegeCommand;
	import com.wandian.data.GameData;
	import com.wandian.model.AccountProxy;
	import com.wandian.model.SwfDataProxy;
	import com.wandian.model.UserInfoProxy;
	import com.wandian.model.vo.MessageVo;
	import com.wandian.model.vo.PlayerVo;
	import com.wandian.model.vo.RoomVo;
	import com.wandian.util.ButtonUtil;
	import com.wandian.util.CLZLoadIcon;
	import com.wandian.util.CLZTabBar;
	import com.wandian.util.LoadIconUtil;
	import com.wandian.util.Res;
	import com.wandian.util.UIHelper;
	import com.wandian.util.loader.ImageLoader;
	import com.wandian.view.components.ui.LevelManage;

	import flash.display.Bitmap;
	import flash.display.BitmapData;
	import flash.display.MovieClip;
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.events.MouseEvent;
	import flash.events.TextEvent;
	import flash.utils.ByteArray;

	import org.puremvc.as3.interfaces.INotification;
	import org.puremvc.as3.patterns.mediator.Mediator;

	/**
	 * 游戏大厅
	 * @author long
	 */
	public class LobbyMediator extends Mediator
	{
		public static const NAME:String="LobbyMediator";
		private var _tabBar:CLZTabBar; //分页选项卡tab
		private var _global:GameData;
		private var _userInfo:UserInfoProxy;
		private var _mcLevel:LevelManage;
		private var _swfData:SwfDataProxy;
		private var _accountProxy:AccountProxy;
		private var _arrRoomListData:Array;
		private var imageLoader:ImageLoader;

		public function LobbyMediator(viewComponent:Object=null)
		{
			super(NAME, viewComponent);
			this._global=GameData.getInstance();
			this._userInfo=GameData.getInstance().userInfo;
			this._mcLevel=new LevelManage();
			imageLoader=new ImageLoader();
			imageLoader.addEventListener(Event.COMPLETE, completeImage);
		}

		protected function completeImage(event:Event):void
		{
			// TODO Auto-generated method stub
			while (headSprite.numChildren)
			{
				headSprite.removeChildAt(0);
			}
			headSprite.name="headSprite";
			trace(imageLoader.bitmapdata.width + ":" + imageLoader.bitmapdata.height);
			var bitmap:Bitmap=new Bitmap(imageLoader.bitmapdata);
			trace(bitmap.width + ":" + bitmap.height);
//			bitmap.width=bitmap.height=50;
			headSprite.addChild(bitmap);
			trace(headSprite.width + ":" + headSprite.height);
			headSprite.width=headSprite.height=50;
			headSprite.buttonMode=true;
			headSprite.mouseChildren=false;
		}

		override public function listNotificationInterests():Array
		{
			return [CLZNoticeName.UPDATE_MONEY,CLZNoticeName.UPDATE_PERSON_HEAD_SUC, CLZNoticeName.HIDE_UPLOADHEADER_PANEL, CLZNoticeName.LOBBY_ROOMLIST_RSP, CLZNoticeName.FAST_ENTER_ROOM_RSP, CLZNoticeName.LOBBYMEDIATOR_CMDRES_FRIENDLIST, CLZNoticeName.CONNECT_SOCKET, CLZNoticeName.CONNECT_SOCKET_SUCC, CLZNoticeName.UPDATE_GOLD, CLZNoticeName.UPDATE_LEVEL, CLZNoticeName.UPDATE_RANK_USER, CLZNoticeName.GAME_ROOM_SOCKET_CLOSE, CLZNoticeName.MESSAGE_SYSTEM_RES, CLZNoticeName.GIVE_GIFT_RES, CLZNoticeName.ENTER_GAME_ROOM_REQ, CLZNoticeName.FRIEND_LIST_RES, CLZNoticeName.OUT_GAME_ROOM_RSP, CLZNoticeName.HIDE_PAY_BAG_PANEL, CLZNoticeName.HIDE_PRIZE_PANEL, CLZNoticeName.PRIZE_MY_REWARD_1_RES];
		}

		public function getRoomVo(roomid:int):RoomVo
		{
			for each (var room:RoomVo in _arrRoomListData)
			{
				if (room.id == roomid)
					return room;
			}
			return null;

		}

		override public function handleNotification(notification:INotification):void
		{
			var data:Object=null;
			var roomVo:RoomVo;
			var gold:uint;
			switch (notification.getName())
			{
				case CLZNoticeName.LOBBY_ROOMLIST_RSP:
				{
					_arrRoomListData=notification.getBody() as Array;
					this.sendNotification(CLZNoticeName.ROOMLISTMEDIATOR_CMDRES_ROOMLIST, _arrRoomListData);
					trace("[lobbymediator]获取房间列表成功,并且派发给房间列表，房间数:" + _arrRoomListData.length);
					break;
				}
				case CLZNoticeName.FAST_ENTER_ROOM_RSP:
				{
					var roomId=int(notification.getBody());
					roomVo=getRoomVo(roomId);
					if (roomVo == null)
					{
						this.facade.sendNotification(CLZNoticeName.SHOW_MOVE_TIP, {tip: "找不到该房间信息"});
						return;
					}
					roomVo.randomSit=1;
					this.sendNotification(CLZNoticeName.ENTER_GAME_ROOM_REQ, roomVo);
					break;
				}
				case CLZNoticeName.LOBBYMEDIATOR_CMDRES_FRIENDLIST:
				{

					break;
				}
				case CLZNoticeName.LOBBYMEDIATOR_CONNECT_SOCKET_SUCC:
				{
					this.sendNotification(CLZNoticeName.SHOW_FULL_TIP, {tip: "连接成功", isShowBtn: false, btnName: "", strNoticeName: ""});
					this.sendNotification(CLZNoticeName.HIDE_FULL_TIP);
					this.sendNotification(CLZNoticeName.SHOW_TOP);
					this.initSocketSuccData();
					break;
				}
				case CLZNoticeName.CONNECT_SOCKET:
				{
					this.sendNotification(CLZNoticeName.HIDE_TOP);
					this.sendNotification(CLZNoticeName.SHOW_FULL_TIP, {tip: GameData.tip["CONNECTSOCKET"], isShowBtn: false, btnName: "", strNoticeName: ""});
					break;
				}
				case CLZNoticeName.CONNECT_SOCKET_SUCC:
				{
//					this.sendNotification(CLZNoticeName.SHOW_FULL_TIP, {tip: GameData.tip["CONNECTSOCKETSUCC"], isShowBtn: false, btnName: "", strNoticeName: ""});
//					this.sendNotification(CLZNoticeName.HIDE_FULL_TIP);
//					this.sendNotification(CLZNoticeName.SHOW_TOP);
//					this.initSocketSuccData();
					break;
				}
				case CLZNoticeName.GAME_ROOM_SOCKET_CLOSE:
				{
					roomVo=notification.getBody() as RoomVo;
					//您的网络已断开,点击确定重新进入房间
					data={okNoticeName: CLZNoticeName.ENTER_GAME_ROOM_REQ, tip: GameData.tip["CONNECT_GAME_ROOM_SOCKET"], tipTitle: GameData.tip["SYSTEM_TIP"], data: roomVo, isCancel: true};
					this.sendNotification(CLZNoticeName.SHOW_WINDOWS_TIP, data);
					break;
				}
				case CLZNoticeName.UPDATE_MONEY:
				{
					var money:Number=notification.getBody() as Number;
					this.mcTable.gold_txt.text=money.toString();
					break;
				}
				case CLZNoticeName.UPDATE_GOLD:
				{
					//					gold=notification.getBody() as Number;
					//					this.mcTable.gold_txt.text=gold.toString();
					break;
				}
				case CLZNoticeName.UPDATE_LEVEL:
				{
					var level:uint;
					level=notification.getBody() as uint;
					this._mcLevel.updateLevel(this.mcTable["level_mc"], level, false);
					this._mcLevel.playFlash(3);
					break;
				}
				case CLZNoticeName.UPDATE_RANK_USER:
				{
					this.mcTable.rank_txt.text=this._global.userInfo.userVo.rank.toString();
					break;
				}
				case CLZNoticeName.MESSAGE_SYSTEM_RES:
				{
					this.showNoticeList(notification.getBody() as Array);
					break;
				}
				case CLZNoticeName.GIVE_GIFT_RES:
				{
					data=notification.getBody();
					if (data.toMid == this._global.userInfo.userVo.userid)
					{
					}
					if (GameData._objRoom == null)
					{
					}
					if (data.pcate <= 10)
					{
						this._global.userInfo.money=data.money;
//						this._accountProxy = facade.retrieveProxy(AccountProxy.NAME) as AccountProxy;
//						this._accountProxy.addProp(data.pcate, data.pframe, data.num);
					}
					break;
				}
				case CLZNoticeName.ENTER_GAME_ROOM_REQ:
				{
					if (this._global.userInfo.userVo.userid == 0)
					{
						this.sendNotification(CLZNoticeName.SHOW_SELECTED_PERSON);
						this.sendNotification(CLZNoticeName.SHOW_MOVE_TIP, {tip: GameData.tip["SELECTED_PERSON_ENTER_GAME_TIP"]});
						return;
					}
					roomVo=notification.getBody() as RoomVo;
					if (roomVo == null)
					{
						trace("大厅收到进入房间请求,room没有选,快速进入游戏");
						this.sendNotification(CLZNoticeName.FAST_ENTER_GAME_REQ);
						return;
					}
					if (roomVo.close == 1)
					{
						this.sendNotification(CLZNoticeName.SHOW_BUY_VIP_PANEL_TIP);
						return;
					}
					if (roomVo.close == 2)
					{
						this.sendNotification(CLZNoticeName.SHOW_BUY_VIP_PANEL_TIP);
						return;
					}
					trace("stopMcAllChild");
					GameData.stopMcAllChild(this.mcTable.prize_btn);
//					this._swfData.singleLoadSWF("face");
					trace("大厅收到进入房间请求,房间信息:" + roomVo.id);
					this.sendNotification(CLZNoticeName.ENTER_GAME_ROOM, roomVo);
					break;
				}
				case CLZNoticeName.FRIEND_LIST_RES:
				{
//					this.init();
					break;
				}
				case CLZNoticeName.OUT_GAME_ROOM_RSP:
				{
					data=notification.getBody();
					if (this._global.userInfo.userVo.userid == data.userid)
					{
						GameData.playMcAllChild(this.mcTable.prize_btn);
						this._global._returnRoomNum++;
						if (this._global._returnRoomNum == 1)
						{
							if (!this._global.userInfo.userVo.isaddf)
							{
								if (this._global.userInfo.userVo.gp != GameData.QZONE_SID)
								{
								}
							}
						}

						if (this._global.userInfo.userVo.gp == GameData.FRIEND_SID)
						{
							if (this._global.userInfo.userVo.isdayfrist)
							{
								this.sendNotification(CLZNoticeName.SHOW_WEIBO_PANEL_TIP);
							}
						}

						if (this._global._returnRoomNum == 2)
						{
							if (this._global.userInfo.userVo.isInviteopen)
							{
								this.sendNotification(CLZNoticeName.NATIONAL_DAY_REQ);
							}
						}

						if (this._global._returnRoomNum == 3)
						{
							if (this._global.userInfo.userVo.isopen)
							{
							}
							if (this._global.userInfo.userVo.isdayfrist)
							{
								//							this._swfData.singleLoadSWF("paybag", CLZNoticeName.SHOW_PAY_BAG_PANEL);
							}
						}

						if (GameData.IS_ENTER_ROOM)
						{
							GameData.IS_ENTER_ROOM=false;
							this.sendNotification(CLZNoticeName.FAST_ENTER_GAME_REQ);
						}
					}
					break;
				}
				//关闭上传头像
				case CLZNoticeName.HIDE_UPLOADHEADER_PANEL:
				{
					headSprite.addEventListener(MouseEvent.CLICK, headSpriteClickHandler);
					break;
				}
				case CLZNoticeName.UPDATE_PERSON_HEAD_SUC:
				{
					imageLoader.loadBytes(notification.getBody() as ByteArray);
					break;
				}
				case CLZNoticeName.HIDE_PAY_BAG_PANEL:
				{
//					this.showPop();
					break;
				}
				case CLZNoticeName.HIDE_PRIZE_PANEL:
				{
//					this.checkPopUp();
					break;
				}
				case CLZNoticeName.PRIZE_MY_REWARD_1_RES:
				{
					if (this._global.userInfo.userVo.gp == GameData.QQSGAME_SID)
					{
						return;
					}
					if (this._global.userInfo.userVo.isdayfrist)
					{
//						this.onPrizeHandler(null);
					}
					else
					{
//						this.checkPopUp();
					}
					break;
				}
				default:
				{
					break;
				}
			}
		}

		private function showNoticeList(arrMsgVo:Array):void
		{
			var msgVo:MessageVo=null;
			this.mcTable.notice_txt.htmlText="";
			var index:int=0;
			while (index < arrMsgVo.length)
			{
				if (index >= 3)
				{
					break;
				}
				msgVo=arrMsgVo[index] as MessageVo;
				this.mcTable.notice_txt.htmlText=this.mcTable.notice_txt.htmlText + ("<font size=\'12\'><a href=\"event:" + msgVo.type + "-" + msgVo.id + "\">" + GameData.setDate(msgVo.startTime, 2) + " : " + msgVo.title + "</a></font>");
				index=index + 1;
			}
			return;
		}

		private function onChangeTabBarHandler(event:Event):void
		{
			switch (event.target.name)
			{
				case "game_mc":
				{
					GameData.maxTableType=GameData.G;
					this.showRoomPanel("RoomList");
					break;
				}
				case "timing_mc":
				{
					GameData.maxTableType=GameData.M1;
					GameData.minTableType=GameData.M1;
					this.showRoomPanel("TimingPanel");
					break;
				}
				case "match_mc":
				{
					GameData.maxTableType=GameData.M2;
					GameData.minTableType=GameData.M2;
					this.showRoomPanel("MatchPanel");
					break;
				}
				default:
				{
					break;
				}
			}
			this.sendNotification(CLZNoticeName.UPDATE_FRIEND_STATE);
			return;
		}

		private function showRoomPanel(maxTableTypeName:String):void
		{
			this.removeAllContent();
			var roomList:MovieClip=GameData.getMovieClip(maxTableTypeName);
			this.mcTable.content_mc.addChild(roomList);
			trace("当前到类:" + GameData.maxTableType);
			switch (GameData.maxTableType)
			{
				case GameData.G:
				{
					facade.registerMediator(new RoomListMediator(roomList, this._arrRoomListData));
					break;
				}
				case GameData.M1:
				{
					break;
				}
				case GameData.M2:
				{
					break;
				}
				default:
				{
					break;
				}
			}
			return;

		}

		var headSprite:Sprite;

		public override function onRemove():void
		{
			removeAllContent();
		}

		public override function onRegister():void
		{
			trace("LobbyMediator onRegister");
			//注册子模块命令		
			this._swfData=facade.retrieveProxy(SwfDataProxy.NAME) as SwfDataProxy;
			facade.registerCommand(CLZNoticeName.ENTER_GAME_ROOM, GameRoomCommand);
			facade.registerCommand(CLZNoticeName.OUT_GAME_ROOM_RSP, GameRoomCommand);
			facade.registerCommand(CLZNoticeName.ADD_TOP, TopCommand);
			facade.registerCommand(CLZNoticeName.SHOW_SHOPING_HOT_PROP, ShopCommand);
			facade.registerCommand(CLZNoticeName.SHOW_SHOPING_GIFT, ShopCommand);
			facade.registerCommand(CLZNoticeName.SHOW_SHOPING_VIP, ShopCommand);
			facade.registerCommand(CLZNoticeName.SHOW_SHOPING_INTERACTIVE_PROP, ShopCommand);
			facade.registerCommand(CLZNoticeName.SHOW_GAME_MESSAGE_PANEL, GameMessageCommand);
			facade.registerCommand(CLZNoticeName.GET_ROOM_LIST, LobbyCommand);
			facade.registerCommand(CLZNoticeName.REGISTER_FRIEND_ROOMPLAYER, FriendAndRoomPlayerCommand);
			facade.registerCommand(CLZNoticeName.FRIEND_LIST_REQ, FriendAndRoomPlayerCommand);
			facade.registerCommand(CLZNoticeName.SHOW_ROOM_PALYER_LIST_REQ, FriendAndRoomPlayerCommand);
			facade.registerCommand(CLZNoticeName.PRIZE_MY_REWARD_REQ, PrizeCommand);
			facade.registerCommand(CLZNoticeName.PRIZE_VIP_REWARD_REQ, PrizeCommand);
			facade.registerCommand(CLZNoticeName.PRIZE_WINNUM_REWARD_REQ, PrizeCommand);
			facade.registerCommand(CLZNoticeName.SHOW_SELECTED_PERSON, SelectPersonCommand);
			facade.registerCommand(CLZNoticeName.SHOW_UPLOADHEADER_PANEL, SelectPersonCommand);
			facade.registerCommand(CLZNoticeName.SHOW_ACCOUNT, AccountCommand);
			facade.registerCommand(CLZNoticeName.USEPROPS_BTN, AccountCommand);
			facade.registerCommand(CLZNoticeName.ACHIEVEMENT_BTN, AccountCommand);
			facade.registerCommand(CLZNoticeName.SHOW_BANK_PANEL, BankCommand);
			facade.registerCommand(CLZNoticeName.SHOW_VIP_PRIVILEGE, VIPPrivilegeCommand);
			facade.registerCommand(CLZNoticeName.SHOW_PRIZE_PANEL, PrizeCommand);
			facade.registerCommand(CLZNoticeName.MESSAGE_SYSTEM_REQ, GameMessageCommand);
			facade.registerCommand(CLZNoticeName.SHOW_HELP, HelpCommand);
			facade.registerCommand(CLZNoticeName.NATIONAL_DAY_REQ, PrizeCommand);
			facade.registerCommand(CLZNoticeName.ENTER_GAME_ROOM, GameRoomCommand);
			facade.registerCommand(CLZNoticeName.OUT_GAME_ROOM_RSP, GameRoomCommand);
			facade.registerCommand(CLZNoticeName.TOPCOMMAND_ADD_TOP, TopCommand);
			facade.registerCommand(CLZNoticeName.HELPCOMMAND_SHOW_HELP, HelpCommand);
			this.mcTable.name_txt.htmlText=this._global.userInfo.userVo.name; // + "   <font color=\'#ffff00\'>VIP" + this._global.userInfo.userVo.vip + "</font>"; //"<font color=\'#ffff00\'>彭承龙</font>";
			this.mcTable.idName_txt.text="数字id:";
			this.mcTable.id_txt.text=this._global.userInfo.userVo.userid;
			this.mcTable.levelName_txt.text="财富等级:";
			this.mcTable.goldName_txt.text="金币:";
			this.mcTable.gold_txt.text=this._global.userInfo.userVo.money;
			this.mcTable.rankName_txt.text="全球排名:"; //+ this._global.userInfo.userVo.rank;
			this.mcTable.rank_txt.text=this._userInfo.userVo.rank;
			ButtonUtil.setButton(this.mcTable.info_btn, "个人资料");
//			ButtonUtil.setButton(this.mcTable.vip_btn, "VIP特权", null, true, "0xFFFF00,0xFFFF00,0xFFFF00");
			this.mcTable.removeChild(this.mcTable.vip_btn);
//			ButtonUtil.setButton(this.mcTable.shop_btn, "游戏商城");
			this.mcTable.removeChild(this.mcTable.shop_btn);
			ButtonUtil.setButton(this.mcTable.pic_btn, "更新形象");
//			ButtonUtil.setButton(this.mcTable.bank_btn, "个人银行");
			this.mcTable.removeChild(this.mcTable.bank_btn);
			ButtonUtil.setButton(this.mcTable.help_btn, "新手帮助");
//			var head:String=this._userInfo.userVo.icon;
			if (this._userInfo.userVo.headImage != null)
			{
				headSprite=new Sprite();
				if (!GameData.is800)
				{
					headSprite.x=598;
					headSprite.y=59;
				}
				else
				{
					headSprite.x=493;
					headSprite.y=60;
				}

				this.mcTable.addChild(headSprite);
				imageLoader.loadBytes(this._userInfo.userVo.headImage);
			}
			else
			{
				var head:String=this._userInfo.userVo.sex == 0 ? GameData.config["FemaleHead"] : GameData.config["ManHead"];
				headSprite=CLZLoadIcon.addIcon(this.mcTable, GameData.flashUrl + GameData.config["imageUrl"] + "person/header/" + head, 50, 50, 598, 59, "LoadingData", false);
			}
			headSprite.addEventListener(MouseEvent.CLICK, headSpriteClickHandler);
			headSprite.buttonMode=true;
//			LoadIconUtil.addIcon(this.mcTable, head, 50, 50, 598, 59);
//			CLZLoadIcon.addIcon(this.mcTable, "female", 50, 50, 0, 0, "InitPicGirlIcon", false, false);
//			var log:Bitmap=new Bitmap(new (GameData.getClass("LogoClass") as BitmapData));
//			var log:Bitmap=new Bitmap(Res.get("LogoClass"));
//			var _loc_1:* = new GameData.LogoClass();		
//			this.mcTable.shop_btn.addEventListener(MouseEvent.CLICK, this.onShopHandler);
			this.mcTable.info_btn.addEventListener(MouseEvent.CLICK, this.onInfoHandler);
			this.mcTable.pic_btn.addEventListener(MouseEvent.CLICK, this.onPicHandler);
//			this.mcTable.bank_btn.addEventListener(MouseEvent.CLICK, this.onBankHandler);
//			this.mcTable.vip_btn.addEventListener(MouseEvent.CLICK, this.onCoinHandler);
			this.mcTable.prize_btn.addEventListener(MouseEvent.CLICK, this.onPrizeHandler);
			this.mcTable.help_btn.addEventListener(MouseEvent.CLICK, this.onHelpHandler);
//			CLZLoadIcon.addIcon(this.mcTable.prize_btn, GameData.flashUrl + "assets/img/other/prize_btn.swf", 0, 0, 0, 0, "", false, false);
			this.mcTable.prize_btn.buttonMode=true;
			this.mcTable.notice_txt.addEventListener(TextEvent.LINK, this.linkTxtHandler);
			this.sendNotification(CLZNoticeName.TOPCOMMAND_ADD_TOP);
			this.sendNotification(CLZNoticeName.SOCKETCOMMAND_FRIEND_LIST_REQ);
			this.sendNotification(CLZNoticeName.INIT_CARD_RANK_TIP);
			//增加顶部大log图片 改成png方式
			/*var _class:Class=Class(LogoClass);
			var logo:Bitmap=new Bitmap(new _class());
			this.mcTable.addChild(logo);
			logo.x=21;
			logo.y=50;*/
			if (!GameData.is800)
			{
				CLZLoadIcon.addIcon(this.mcTable, GameData.flashUrl + GameData.config["imageUrl"] + GameData.config["Logo"], 0, 0, 21, 50);
			}
			else
			{
				CLZLoadIcon.addIcon(this.mcTable, GameData.flashUrl + GameData.config["imageUrl"] + GameData.config["Logo"], 0, 0, 13, 35);
			}

			GameData.stopMcAllChild(this.mcTable);
			initSocketSuccData();
			this.init();
//			this.sendNotification(CLZNoticeName.UPDATE_LEVEL, this._userInfo.userVo.level);
			this._mcLevel.updateLevel(this.mcTable["level_mc"], this._userInfo.userVo.level, false);
			this._mcLevel.playFlash(3);
			this._userInfo.requestFriendList();
			facade.sendNotification(CLZNoticeName.SOCKETCOMMAND_ROOM_LIST_REQ); //请求房间列表
		}

		protected function headSpriteClickHandler(event:MouseEvent):void
		{
			event.target.removeEventListener(MouseEvent.CLICK, headSpriteClickHandler);
			trace(" headSpriteClickHandler:" + event.target.name);
			this.sendNotification(CLZNoticeName.SHOW_UPLOADHEADER_PANEL);
		}

		private function initSocketSuccData():void
		{
			var tabs:Array=[[this.mcTable.game_mc, "游戏场"], [this.mcTable.timing_mc, "定时赛"], [this.mcTable.match_mc, "竞技赛"]];
			this._tabBar=new CLZTabBar(tabs);
			var count:int=0;
			while (count < tabs.length)
			{

				tabs[count][0].addEventListener(Event.CHANGE, this.onChangeTabBarHandler);
				count=count + 1;
			}
			this._tabBar.setClickIndex(this.mcTable.game_mc);
			this.sendNotification(CLZNoticeName.REGISTER_FRIEND_ROOMPLAYER, this.mcTable);
			return;
		}

		private function removeAllContent():void
		{
			facade.removeMediator(RoomListMediator.NAME);
			GameData.removeNumChildre(this.mcTable.content_mc);
			return;
		}

		private function init():void
		{
//			this.sendNotification(CLZNoticeName.SOCKETCOMMAND_CONNECT_SOCKET);
			this.sendNotification(CLZNoticeName.SHOW_RANK);
			this.sendNotification(CLZNoticeName.MESSAGE_SYSTEM_REQ, true);
//			this.sendNotification(CLZNoticeName.PRIZE_MY_REWARD_REQ);
			return;
		}

		private function onShopHandler(event:MouseEvent):void
		{
			trace("点了商店");
			return;
//			CLZLoadIcon.addIcon2(this.mcTable, "", 50, 50, 0, 0, "female", false, false);
			var _loc_2:*=new PlayerVo();
			_loc_2=GameData.copyClass(this._global.userInfo.userVo, _loc_2) as PlayerVo;
			if (this._global.userInfo.userVo.gp != GameData.QZONE_SID)
			{
			}
			if (this._global.userInfo.userVo.gp == GameData.FRIEND_SID)
			{
				this.sendNotification(CLZNoticeName.SHOW_SHOPING_VIP, _loc_2);
			}
			else
			{
				this.sendNotification(CLZNoticeName.SHOW_SHOPING_HOT_PROP, _loc_2);
			}
			return;
		}

		private function onInfoHandler(event:MouseEvent):void
		{
			var playerVo:PlayerVo=new PlayerVo();
			playerVo.init();
			playerVo=GameData.copyClass(this._global.userInfo.userVo, playerVo) as PlayerVo;
			this.sendNotification(CLZNoticeName.SHOW_ACCOUNT, playerVo);
			return;
		}

		/**
		 * 测试积宝按秒上涨
		 */
		private function testUpdateJackPot():void
		{
			var objData:Object={};
			objData.toCornucopia=10000;
			objData.offsetCornucopia=720;
			objData.updateCornucopiaSecond=30;
			this.sendNotification(CLZNoticeName.UPDATE_CORNUCOPIA_GOLD, objData);
		}

		/**
		 * 更新游戏形象
		 * @param event
		 */
		private function onPicHandler(event:MouseEvent):void
		{
//			CLZLoadIcon.addIcon(this.mcTable, "", 50, 50, 0, 0, "InitPicGirlIcon", false, false);
			this.sendNotification(CLZNoticeName.SHOW_SELECTED_PERSON);
			return;
		}

		private function onBankHandler(event:MouseEvent):void
		{
			this.sendNotification(CLZNoticeName.SHOW_BANK_PANEL_REQ);
			return;
		}

		private function onCoinHandler(event:MouseEvent):void
		{
			return;
			this._swfData=facade.retrieveProxy(SwfDataProxy.NAME) as SwfDataProxy;
			this._swfData.singleLoadSWF("vip", CLZNoticeName.SHOW_VIP_PRIVILEGE);
			return;
		}

		private function onPrizeHandler(event:MouseEvent):void
		{
			this._swfData=facade.retrieveProxy(SwfDataProxy.NAME) as SwfDataProxy;
			this._swfData.singleLoadSWF("prize", CLZNoticeName.SHOW_PRIZE_PANEL);
			return;
		}

		private function onHelpHandler(event:MouseEvent):void
		{
//			this.sendNotification(CLZNoticeName.SHOW_HELP, 0);
			this.sendNotification(CLZNoticeName.HELPCOMMAND_SHOW_HELP, 0);
			return;
		}

		private function linkTxtHandler(event:TextEvent):void
		{
			trace(event.text);
			this.sendNotification(CLZNoticeName.SHOW_GAME_MESSAGE_PANEL, GameData.SYSTEM_MESSAGE, event.text);
			return;
		}

		public function get mcTable():MovieClip
		{
			return viewComponent as MovieClip;
		}
	}
}
